home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Network Supervisor's Toolkit
/
Network Supervisor's Toolkit.iso
/
tools
/
lu62
/
sendbm.c
< prev
next >
Wrap
C/C++ Source or Header
|
1996-07-10
|
5KB
|
172 lines
/*
SEND_DATA_BUFFER_MANAGEMENT
(SENDBM)
Process the data which then will be sent to HS.
INPUT : Pointer to verb, pointer to RCB.
CopyRight 1995. Nicholas Poljakov all rights reserved.
*/
#include <sendat.h>
#include <state1.h>
#include <rcb.h>
#include <stdio.h>
#include <malloc.h>
#include <string.h>
int sk_r_wt(void *);
int setrc(void *, void *);
int sendhsf(void *);
int sendhs(void *);
int sendbm(void *, void *);
int sendat(void *);
int rtsend(void *);
unsigned long rmfmh5(void *, void *);
int recwait(void *);
int rcvru(void *, void *);
int rcvhs(void *, void *, void *, void *);
int ralloc(void *, void *);
int psrm(int, void *, void *);
int ps_conv(int, void *);
int proterr(void *, unsigned long);
int preptrcv(void *, void *);
int post_rcb(void *);
struct repass *postopen(void *);
int phsrec(void *);
int pfmh5(void *);
int opndst(void *);
int obtsess(void *, unsigned char);
int Lrf_handler(void *);
int get_sess(void *, void *);
int get_attr(void *);
int fsm_error(unsigned char, void *);
int fsm_conv(unsigned char, unsigned char, void *);
int flush (void *);
int dcp(void *);
int dealloc(void *);
int crtp(void *);
int conv(void *);
int chkparm(void *, void *);
int check_end(unsigned int, void *);
struct rqb *call_appl(void *);
int buffmng(unsigned char, void *, void *, void *, unsigned, unsigned char, unsigned);
unsigned long attltck(void *);
unsigned long attacheck(void *);
char *cgetmem(int, int);
int sendhsf(void *);
int opndst(void *);
int alloc_rcb(void *, void *);
int allocate(void *);
int clsdst(void *);
sendbm(pptr, p_rcb)
struct send_data *pptr;
struct rcb *p_rcb;
{
char *p;
int lt;
int rest;
char *p_ll;
unsigned short l_str;
char *p1;
int i;
unsigned short *m;
char code;
char *buff;
unsigned int type;
unsigned char dsc;
unsigned char temp;
#if OS_TYPE == 1
/********* Trace facility **********/
unsigned int rtype; /* type of record */
unsigned int pnum; /* point number */
char pname[8]; /* name of module */
char *drec; /* record for dump */
int lenr; /* record length */
rtype = INPROC;
strcpy(pname, "sendbm");
pnum = 1;
drec = pptr;
lenr = sizeof(struct send_data);
gtf(rtype, pname, pnum, drec, lenr);
/***********************************/
#endif
p_ll = pptr->data_addr;
m = (short *)pptr -> data_addr;
l_str = *m;
p1 = &l_str;
l_str &= 0x7fff; /* turn off high bit */
p = pptr->data_addr;
lt = pptr -> data_lt;
code = 'A';
buff = &((*p_rcb).first_out);
if (p_rcb->send_ll_remainder == 0) {
/* Make the LL-processing;
* Check if LL is wrong (wrong values are the following:
* X'0000',X'8000',X'8001'.
* Value X'0001' is right for PS header only.
*/
m = (short *)pptr-> data_addr;
switch (*m) {
case 0x0000:
/* case 0x0001: */
case 0x8000:
case 0x8001:
goto bad_return;
}
if ((pptr->data_lt) > l_str)
goto bad_return;
p_rcb->send_ll_remainder = l_str - pptr->data_lt;
temp = p[0]; /* for compatibility */
p[0] = p[1]; /* whith */
p[1] = temp; /* IBM mainframe */
}
else
{
if (pptr->data_lt > p_rcb->send_ll_remainder)
goto bad_return; /* One GDS per send */
p_rcb->send_ll_remainder -= pptr->data_lt;
}
rest = lt;
type = Send_data;
do {
rest -= MAX_RU;
if (rest > 0) {
lt = MAX_RU;
dsc = 1;
}
else
{
lt = rest + MAX_RU;
rest = 0;
dsc = 0;
}
if ((p1 = malloc(lt)) == NULL) {
pptr -> prim_rc = INCOMPLETE;
return (0);
}
memcpy(p1, p_ll, lt);
p_ll += lt;
buffmng(code, p1, buff, p_rcb, lt, dsc, type);
} while (rest != 0);
/*
sendhs(p_rcb);
*/
goto ok_return;
bad_return :
pptr->prim_rc = PARAMETR_CHECK;
pptr->sec_rc = BAD_LL;
ok_return :
return(0);
}